# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Duncan Bellamy <dunk@denkimushi.com>
pkgname=py3-bcrypt-ceph
_pkgname=bcrypt
pkgver=4.0.1
pkgrel=1
pkgdesc="Modern password hashing for your software and your servers"
url="https://github.com/pyca/bcrypt"
arch="all"
license="Apache-2.0"
depends="py3-cffi"
makedepends="
	libffi-dev
	py3-cparser
	py3-gpep517
	py3-setuptools
	py3-setuptools-rust
	py3-wheel
	python3-dev
	"
checkdepends="py3-pytest"
options="net"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/pyca/$_pkgname/archive/$pkgver.tar.gz
	name.patch"
builddir="$srcdir/$_pkgname-$pkgver"

prepare() {
	default_prepare
	mv src/bcrypt src/bcrypt_ceph
}

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*whl
}

sha512sums="
eb7b1d67a2d60e82e2d2e4dcb12d7808be910f9b7aefab714a22dedbffc3722182875fdcf3c8c650c0bb7c1122e9e8bead92f18bc660043b017a14957467e2a9  py3-bcrypt-ceph-4.0.1.tar.gz
946e67452fbb4634022ee02c8163639af28a185e8f9ce0fe675c7a47450751fa19ff75bf509d576b96671785e85e1a685f6dacdaa1aae1aab0dadca9d43bed61  name.patch
"
